#!/usr/bin/env python3
# -*- coding: utf-8 -*-
########################################################################
#
# Copyright (c) 2023 Zhiyong Lin. All Rights Reserved
#
########################################################################
'''
@File    :   config.py
@Time    :   2025/10/20 15:45:10
@Author  :   lzy2lcy 
@Version :   1.0
@Desc    :   
'''

import os

def env_default(k, v):
    config = globals()
    v_type = type(v)
    if k not in os.environ:
        config[k] = v
    elif v_type == bool:
        config[k] = True if os.environ[k] == 'True' else False
    elif v_type == list:
        config[k] = os.environ[k].split(';')
    else:
        config[k] = v_type(os.environ[k])

    # 通用配置
env_default('DEBUG', False)
env_default('MCP_HOST', '0.0.0.0')
env_default('MCP_PORT', 50001)
env_default('LOG_DIR', '/')
env_default('GUNICORN_WORKER_COUNT', 32)
env_default('GUNICORN_WORKER_CLASS', 'eventlet')


# 天气API配置
env_default('WEATHER_API_KEY', '')